package org.martyn.danbodroid.gui;

import android.content.Context;
import android.widget.TextView;

public class PreferenceRowDouble extends PreferenceRow
{
	private String key;

	public PreferenceRowDouble(Context context, String key)
	{
		super(context);

		this.addView(inflate(context, android.R.layout.simple_list_item_2, null));

		this.key = key;
	}

	public PreferenceRowDouble(
			Context context,
			String key,
			int titleResourceId,
			int summaryResourceId)
	{
		super(context);

		this.addView(inflate(context, android.R.layout.simple_list_item_2, null));

		this.key = key;

		setTitle(titleResourceId);
		setSummary(summaryResourceId);
	}

	public void setTitle(int titleResourceId)
	{
		((TextView) findViewById(android.R.id.text1)).setText(titleResourceId);
	}

	public void setTitle(String title)
	{
		((TextView) findViewById(android.R.id.text1)).setText(title);
	}

	public void setSummary(int summaryResourceId)
	{
		((TextView) findViewById(android.R.id.text2))
				.setText(summaryResourceId);
	}

	public void setSummary(String summary)
	{
		((TextView) findViewById(android.R.id.text2)).setText(summary);
	}

	public String getKey()
	{
		return key;
	}
}
